<template lang="html">
  <div class="main-page" id="loan-page">
    <!-- 标题 -->
    <nav-bar :title="'运费优惠'"/>
    <!-- 主体内容 -->
    <div class="main-content has-main-tabbar has-header-space">
      <div class="parcel">
        <div class="parcel_table">
            <ul>
              <li>配送区域</li>
              <li>配送方式</li>
              <li>包邮规则</li>
            </ul>
            <ul v-for="(i, k) in expressData" v-bind:key="k">
              <li><span v-for="(ii, kk) in i.areas" v-bind:key="kk">{{ii}} <i v-if="kk + 1 !== i.areas.length">、</i></span></li>
              <li>普通快递</li>
              <li>{{i.msg}}</li>
            </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import NavBar from '@/components/global/nav-bar.vue'
export default {
  components: { NavBar },
  data () {
    return {
      expressData: {}
    }
  },
  created () {
    this.getData(this.$route.query.id)
  },
  methods: {
    getData (id) {
      var data = {
        id: id
      }
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'product_express_detail', params: data, method: 'get' }).then((res) => { // 请求成功
          if (res.return_code === '0000') {
            this.expressData = res.data.list
          } else {
            this.$toast(res.return_msg)
          }
          resolve(res)
        }).catch((error) => { // 请求失败
          this.$toast.success('请求失败！')
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    }
  }
}
</script>
